<template>
    <div style="background:#2d3a4b;height:100vh">
        <div id="box">
            <h1>在线教育网后台管理系统</h1>
            <el-input v-model="email" placeholder="请输入你的邮箱" prefix-icon="el-icon-user-solid"></el-input>
            <el-input placeholder="请输入密码" v-model="password" show-password prefix-icon="el-icon-s-cooperation
"></el-input>
            <el-button type="primary" @click="deng()">登录</el-button>
            <p style="color:#fff;" @click="tiao()">您还没有账户？点击注册</p>
        </div>
    </div>
</template>
<script>
import { getlogin } from '../untils/api'
export default {
    data() {
        return {
            email: '27732357@qq.com',
            password: '321321'
        }
    },
    methods: {
        tiao() {
            
            this.$router.push('/register')
        },
        deng() {
            getlogin({ email: this.email, password: this.password }).then(config => {

                // this.$message({
                //     message: `${config.response.data.msg}`,
                //     type: 'warning'
                // });
                // console.log(config);
                sessionStorage.setItem('token', config.data.token)
                this.$message({
                    showClose: true,
                    message: '登录成功',
                    type: 'success'
                });
                this.$router.push('/first')
            })
        }
    },
    // created(){
    //     getlogin()
    // }
}
</script>
<style lang="scss" scoped>
#box {
    width: 600px;
    height: 400px;
    position: fixed;
    top: calc(50% - 200px);
    left: calc(50% - 300px);

    h1 {
        color: #fff;
        margin-bottom: 40px;
        text-align: center
    }

    .el-input {
        margin-bottom: 40px;
    }

    .el-button {
        width: 100%;
        margin-bottom: 30px
    }

    p {
        text-align: end
    }
}
</style>


